<template>
  <div v-if="items.length" class="pendbox">
    <div class="subjectbox">
      <div class="header" style="margin-bottom: 12px">
        <div class="title">频道精选</div>
      </div>
      <div class="grid grid-gutter">
        <div v-for="(item,index) in items" :key="index" class="grid-1-2">
          <div class="item" @click="onSpecialTap(item)">
            <chimage class="img" :src="item.adv_img"></chimage>
            <div class="titlebar">
              <div class="title">{{item.adv_name}}</div>
              <img class="icon" src="@/assets/img/icon_item_zt.png">
            </div>
            <div class="desc">{{item.adv_text}}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'mallSpecial',
    props: {
      items: Array
    },
    methods: {
      onSpecialTap (item) {
        this.$router.push({ name: 'mallSpecial', params: { topicId: item.topic_id }, query: { item: JSON.stringify(item) } })
      }
    }
  }
</script>

<style lang="less" scoped>
  .pendbox {
    .header {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .title {
        font-size: 15px;
        color: #351009;
        line-height: 24px;
      }

      .subtitle {
        font-size: 12px;
        color: #848484;
      }

      .more {
        color: #a8a8a8;
        font-size: 12px;
      }
    }
  }

  .subjectbox {
    padding: 12px;
    background-color: #fff;

    .item {
      background-color: #beaf90;
      border-radius: 10px;

      .img {
        display: block;
        border-radius: 10px;
        height: 127px;
        width: 100%;
        background-size: cover;
        background-color: #f5f5f5;
      }

      .titlebar {
        box-sizing: border-box;
        padding-left: 12px;
        padding-right: 12px;
        padding-top: 12px;
        display: flex;
        font-size: 14px;
        line-height: 20px;
        color: #fff;
        align-items: center;
      }

      .title {
        flex: 1;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
      }

      .icon {
        height: 15px;
        width: 15px;
        border-radius: 8px;
        background-color: #fff;
      }

      .desc {
        margin-top: 5px;
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 12px;
        font-size: 12px;
        color: #fff;
        line-height: 17px;
      }
    }
  }
</style>
